/*
 * SystemPropertyTableModel.java
 *
 * Created on 24 September 2004, 09:18
 * Copyright (C) 2004, Velocityme Partnership
 */

package com.velocityme.client.gui.licencemanagement;

import com.velocityme.client.gui.VectorTableModel;
import com.velocityme.utility.LicenceKey;
import java.util.Date;

/**
 *
 * @author  Robert Crida Work
 */
public class LicenceManagementTableModel extends VectorTableModel {
    
    /** Creates a new instance of SystemPropertyTableModel */
    public LicenceManagementTableModel() {
        super(new String[] {"Created", "Expires", "Type" });
    }
    
    public void addValues(LicenceKey[] p_values) {
        m_dataRows.clear();
        for (int i = 0; i < p_values.length; i++) {
	    LicenceKey licenceKey = p_values[i];
            if (licenceKey != null) {
                Date creationDate = licenceKey.getCreationDate();
                Date expiryDate = licenceKey.getExpiryDate();
                String type = licenceKey.toString();
                m_dataRows.addElement(new Object[]{ creationDate, expiryDate, type });
            }
            else
                m_dataRows.addElement(new Object[]{ null, null, "Invalid licence" });
        }
    }
    
}
